<?php

namespace App\Models;

use App\Models\Contract\SerializeDatetime;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Group extends Model
{
    use HasFactory, SerializeDatetime;

    protected $fillable = [
        'user_id', 'created_by', 'members'
    ];

    public function owner()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function members()
    {
        return $this->hasMany(GroupMember::class, 'group_id');
    }
}
